package com.egdigital.allzic.data.object;

import java.util.List;

import android.os.Parcel;
import android.os.Parcelable;

public class Station implements Parcelable, Comparable<Station> {

	public static String	STATION_TAG			= "station_tag";
	public static String	STATION_PRE_START	= "station_pre_start";
	private long			mId;
	private String			mTitle;
	private String			mSubtitle;
	private String			mGenre;
	private int				mHq;
	private String			mCategory;
	private String			mThumb;
	private String			mThumbMobile;
	private String			mBackground;
	private String			mUrl;
	private String			mFlux_aac;
	private String			mFlux_mp3;
	private String			mPlaylist;
	private int				mHits;
	private List<Integer>	mListCategory;
	public int				isFavorite;
	private String			mDate;

	/**
	 * Constructor
	 */
	public Station(long mId, String mTitle, String mSubtitle, String mGenre, int mHq, String mCategory, String mThumb, String mThumbMobile, String mBackground, String mUrl, String mFlux_aac, String mFlux_mp3, String mPlaylist, int mHits, List<Integer> mListCategory, String date) {
		super();
		this.mId = mId;
		this.mTitle = mTitle;
		this.mSubtitle = mSubtitle;
		this.mGenre = mGenre;
		this.mHq = mHq;
		this.mCategory = mCategory;
		this.mThumb = mThumb;
		this.mThumbMobile = mThumbMobile;
		this.mBackground = mBackground;
		this.mUrl = mUrl;
		this.mFlux_aac = mFlux_aac;
		this.mFlux_mp3 = mFlux_mp3;
		this.mPlaylist = mPlaylist;
		this.mHits = mHits;
		this.mListCategory = mListCategory;
		this.isFavorite = 0;
		this.mDate = date;
	}

	/**
	 * Getter & setter
	 */
	public long getmId() {
		return mId;
	}

	public String getmTitle() {
		return mTitle;
	}

	public String getmSubtitle() {
		return mSubtitle;
	}

	public String getmGenre() {
		return mGenre;
	}

	public int getmHq() {
		return mHq;
	}

	public String getmCategory() {
		return mCategory;
	}

	public String getmThumb() {
		return mThumb;
	}

	public String getmBackground() {
		return mBackground;
	}

	public String getmUrl() {
		return mUrl;
	}

	public String getmFlux_aac() {
		return mFlux_aac;
	}

	public String getmFlux_mp3() {
		return mFlux_mp3;
	}

	public String getmPlaylist() {
		return mPlaylist;
	}

	public int getmHits() {
		return mHits;
	}

	public List<Integer> getmListCategory() {
		return mListCategory;
	}

	public void setmId(long mId) {
		this.mId = mId;
	}

	public void setmTitle(String mTitle) {
		this.mTitle = mTitle;
	}

	public void setmSubtitle(String mSubtitle) {
		this.mSubtitle = mSubtitle;
	}

	public void setmGenre(String mGenre) {
		this.mGenre = mGenre;
	}

	public void setmHq(int mHq) {
		this.mHq = mHq;
	}

	public void setmCategory(String mCategory) {
		this.mCategory = mCategory;
	}

	public void setmThumb(String mThumb) {
		this.mThumb = mThumb;
	}

	public void setmBackground(String mBackground) {
		this.mBackground = mBackground;
	}

	public void setmUrl(String mUrl) {
		this.mUrl = mUrl;
	}

	public void setmFlux_aac(String mFlux_aac) {
		this.mFlux_aac = mFlux_aac;
	}

	public void setmFlux_mp3(String mFlux_mp3) {
		this.mFlux_mp3 = mFlux_mp3;
	}

	public void setmPlaylist(String mPlaylist) {
		this.mPlaylist = mPlaylist;
	}

	public void setmHits(int mHits) {
		this.mHits = mHits;
	}

	public void setmListCategory(List<Integer> mListCategory) {
		this.mListCategory = mListCategory;
	}

	public String getmDate() {
		return mDate;
	}

	public void setmDate(String mDate) {
		this.mDate = mDate;
	}

	public String getmThumbMobile() {
		return mThumbMobile;
	}

	public void setmThumbMobile(String mThumbMobile) {
		this.mThumbMobile = mThumbMobile;
	}

	@Override
	public String toString() {
		return String.format("%s  %s  \n %s", mTitle, mCategory, mUrl);
	}

	/**
	 * Parcel
	 */
	public Station(Parcel parcel) {
		mId = parcel.readLong();
		mTitle = parcel.readString();
		mSubtitle = parcel.readString();
		mGenre = parcel.readString();
		mHq = parcel.readInt();
		mCategory = parcel.readString();
		mThumb = parcel.readString();
		mThumbMobile = parcel.readString();
		mBackground = parcel.readString();
		mUrl = parcel.readString();
		mFlux_aac = parcel.readString();
		mFlux_mp3 = parcel.readString();
		mPlaylist = parcel.readString();
		mHits = parcel.readInt();
		// if (mListCategory != null) {
		// parcel.readList(mListCategory, Integer.class.getClassLoader());
		// } else {
		// Log.i("lolol", "null");
		// }
		isFavorite = parcel.readInt();
		mDate = parcel.readString();
	}

	@Override
	public int describeContents() {
		// not used
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeLong(mId);
		dest.writeString(mTitle);
		dest.writeString(mSubtitle);
		dest.writeString(mGenre);
		dest.writeInt(mHq);
		dest.writeString(mCategory);
		dest.writeString(mThumb);
		dest.writeString(mThumbMobile);
		dest.writeString(mBackground);
		dest.writeString(mUrl);
		dest.writeString(mFlux_aac);
		dest.writeString(mFlux_mp3);
		dest.writeString(mPlaylist);
		dest.writeInt(mHits);
		// if (mListCategory != null) {
		// dest.writeList(mListCategory);
		// }
		dest.writeInt(isFavorite);
		dest.writeString(mDate);
	}

	public static Creator<Station>	CREATOR	= new Creator<Station>() {

												public Station createFromParcel(Parcel parcel) {
													return new Station(parcel);
												}

												public Station[] newArray(int size) {
													return new Station[size];
												}
											};

	@Override
	public int compareTo(Station another) {
		if (Long.parseLong(mDate) < Long.parseLong(another.getmDate())) {
			return -1;
		} else {
			return 1;
		}
	}
}
